# coding = utf-8
import unittest
from util.request_util import RequestUtil

host = "https://api.xdclass.net"


class UserTsetCase(unittest.TestCase):
    def testFavorite(self):
        """
        收藏视频
        """
        request = RequestUtil()
        url = host + "/pub/api/v1/web/is_favorite"
        headers = {"Content-Type": "application/x-www-form-urlencoded",
                   "token": "xdclasseyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ4ZGNsYXNzIiwicm9sZXMiOiIxIiwiaW1nIjoiaHR0cHM6Ly90aGlyZHd4LnFsb2dvLmNuL21tb3Blbi92aV8zMi9RMGo0VHdHVGZUSWZ1d3EwenRkMnRXWkZaek9sZ1JISklIVFJDN1hManNPM1lBRUtmTUliZzhtampHNnRjdW9CWGhNeUZzNmtpYTlqeGljTDRVbWx5Q0tRLzEzMiIsImlkIjo2Nzg0NDUyLCJuYW1lIjoi5a2j6aOOIiwiaWF0IjoxNjEyMzQ2MzE2LCJleHAiOjE2MTI5NTExMTZ9.gHkzQzxNdoIAaVpLGIqo8Z_IkkTilsW4dQE82DBkSyI"
                   }
        data = {"video_id": 3}
        response = request.request(url, "post", headers=headers, param=data,
                                   content_type="application/x-www-form-urlencoded")
        self.assertEqual(response["code"], 0, "业务状态不成常")
        self.assertEqual(response["msg"], "已经加入收藏夹", "响应描述信息不正确")
        self.assertEqual(response["data"]["videoId"], data["video_id"], "收藏视频不正确")



if __name__ == '__main__':
    unittest.main(verbosity=2)
